package com.zw._01_hello_world;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.zw.ConnectionUtil;

public class Sen {

    //队列名
    public static final String MQ_QUEUE = "hello_world";

    public static void main(String[] args) throws Exception {
        //获取连接
        Connection connection = ConnectionUtil.getConnection();
        //创建通道
        Channel channel = connection.createChannel();
        //声明队列
        channel.queueDeclare(MQ_QUEUE,true,false, false, null);
        //发送消息
        channel.basicPublish("", MQ_QUEUE, null, "hello world my love".getBytes());
        System.out.println("信息发送成功");
    }
}